package tblModelCategorie;
import java.util.ArrayList;


import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;
import daoDataFactory.DaoFactory;
import domijn.Categorie;
import domijn.Tafel;
import pnlBeheer.PnlCatBeheer;

public class TMCategorie implements TableModel {

	@SuppressWarnings("unused")
	private PnlCatBeheer pnlCatBeheer;
	
	private String []names = {"Naam"};
	private ArrayList<Categorie> ALCategorie;
	private Categorie c;

	public TMCategorie(PnlCatBeheer pnlCatBeheer) {
		this.pnlCatBeheer = pnlCatBeheer;
		ALCategorie = DaoFactory.getwokapplicatie().getDaoICategorie().loadall();
		System.out.println(c);
	}
	
	@Override
	public int getRowCount() {
		return ALCategorie.size();
	}

	@Override
	public int getColumnCount() {
		return names.length;
	}
	
	@Override
	public String getColumnName(int column) {
		return names[column];
	}

	@Override
	public Class<Tafel> getColumnClass(int column) {
		return Tafel.class;
	}

	@Override
	public boolean isCellEditable(int arg0, int arg1) {
		return false;
	}
	
	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		c = ALCategorie.get(rowIndex);
		 switch (columnIndex){
         case 0:
              return c.getCatName();
      
            }
        return c;
        }

	@Override
	public void addTableModelListener(TableModelListener arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeTableModelListener(TableModelListener arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setValueAt(Object arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub
		
	}



	
}